/// 查询活动列表请求参数模型
class ActivityListRequest {
  final double latitude;
  final double longitude;
  final double? radius;
  final int? limit;
  final int? page;
  final String timestamp;

  ActivityListRequest({
    required this.latitude,
    required this.longitude,
    this.radius,
    this.limit,
    this.page,
    required this.timestamp,
  });

  /// 从JSON创建实例
  factory ActivityListRequest.fromJson(Map<String, dynamic> json) {
    return ActivityListRequest(
      latitude: (json['latitude'] as num).toDouble(),
      longitude: (json['longitude'] as num).toDouble(),
      radius: json['radius'] != null ? (json['radius'] as num).toDouble() : null,
      limit: json['limit'],
      page: json['page'],
      timestamp: json['timestamp'],
    );
  }

  /// 转换为JSON
  Map<String, dynamic> toJson() {
    return {
      'latitude': latitude,
      'longitude': longitude,
      if (radius != null) 'radius': radius,
      if (limit != null) 'limit': limit,
      if (page != null) 'page': page,
      'timestamp': timestamp,
    };
  }

  @override
  String toString() {
    return 'ActivityListRequest{latitude: $latitude, longitude: $longitude, radius: $radius, limit: $limit, page: $page, timestamp: $timestamp}';
  }
}
